<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
    <head>
        <title>职位管理</title>
        <meta http-equiv="content-type" content="text/html;charset=utf-8">
        <link href="../../css/mine.css" type="text/css" rel="stylesheet">
    </head>

    <body>

        <div class="div_head">
            <span>
                <span style="float:left">当前位置是：-》职位管理</span>
                <span style="float:right;margin-right: 8px;font-weight: bold">
                    <a style="text-decoration: none" href="list.jsp">【返回】</a>
                </span>
            </span>
        </div>
        <div></div>

        <div style="font-size: 13px;margin: 10px 5px">
            <form id="formData">
            <table border="1" width="100%" class="table_a">
                <tr>
                    <td width="120px;">职位编码<span style="color:red">*</span>：</td>
                    <td><input type="text" name="roleNum" value="QMXC-001002" /></td>
                </tr>
                <tr>
                    <td>职位名称<span style="color:red">*</span>：</td>
                    <td> <input type="text" name="roleName" value="人事总监" /> </td>
                </tr>
                <tr>
                    <td>职位分类<span style="color:red">*</span>：</td>
                    <td>
						<select name="roleClassify">
							<option value="-1">请选择</option>
                            <c:forEach var="i" items="${classify}">
							<option value="${i.posId}">${i.classifyName}</option>
                            </c:forEach>
						</select>
					</td>
                </tr>
                <tr>
                    <td>所属部门<span style="color:red">*</span>：</td>
                    <td>
						 <select name="deptId">
                             <option value="-1">请选择</option>
                             <c:forEach var="i" items="${deptList}">
							<option value="${i.deptId}">${i.deptName}</option>
                             </c:forEach>
						</select>

                    </td>
                </tr>
				
				<tr>
                    <td>菜单权限<span style="color:red">*</span>：</td>
                    <td>
                        <c:forEach var="m1" items="${menuList}">
                        <input type="checkbox" name="mid" value="${m1.menuId}"  />${m1.menuName}<br/>
                            <c:forEach var="m2" items="${m1.secondMenu}">
					&nbsp;&nbsp;&nbsp;<input type="checkbox" name="mid" value="${m2.menuId}" />${m2.menuName}<br/>
                            </c:forEach>
                        </c:forEach>
                    </td>
                </tr>


				<tr>
                    <td>职位描述<span style="color:red">*</span>：</td>
                    <td>
                        <textarea name="desc"></textarea>
                    </td>                
                </tr>

				<tr>
                    <td>备       注：</td>
                    <td>
                        <textarea name="content"></textarea>
                    </td>                
                </tr>
				<tr>
                    <td>是否启用：</td>
                    <td>
                        <select name="roleStatus">
							<option value="0">是</option>
							<option value="1">否</option>
						</select>
                    </td>                
                </tr>
				
                <tr>
                    <td colspan="2" align="center">
                        <input type="button" onclick="subMit()" value="添加">
						<input type="reset" value="重置">
                    </td>
                </tr>  
            </table>
            </form>
        </div>
    </body>
<script src="/js/jquery.min.js"></script>
<script>
    function subMit() {
        var formData = $("#formData").serialize();
        $.post(
            "/position/add",
            formData,
            function (result) {
                if(result.code==0){
                    alert("添加成功");
                    location.href="${pageContext.request.contextPath}/position/list"
                }else{
                    alert("添加失败");
                }
            },
            "json"
        )
    }
</script>
</html>